/*-----------------------------------------------------------------------------
 * @file   hal_adc.h
 * @brief  interface for ADC module operations
 * @author WLH<wanglehui8357@163.com> Copyright (C) 2021~2099.
 ----------------------------------------------------------------------------*/
#ifndef HAL_ADC_H
#define HAL_ADC_H

#include "globaldef.h"

BEGIN_DECLS

/*-----------------------------------------------------------------------------
 * Predefine ADC channel number
-----------------------------------------------------------------------------*/
#define HAL_ADC_CH0     0x00u
#define HAL_ADC_CH1     0x01u
#define HAL_ADC_CH2     0x02u
#define HAL_ADC_CH3     0x03u
#define HAL_ADC_CH4     0x04u
#define HAL_ADC_CH5     0x05u
#define HAL_ADC_CH6     0x06u
#define HAL_ADC_CH7     0x07u
#define HAL_ADC_CH_NULL 0xFFu

/*-----------------------------------------------------------------------------
 * public functions declaration
-----------------------------------------------------------------------------*/
/**
 * @brief Initialize ADC Peripheral
 */
bool hal_adc_init(void);
/**
 * @brief get supported ADC channel count
 */
U8 hal_adc_ch_count(void);
/**
 * @brief      read ADC data from channel
 * @param[in]  ch  The channel to be read
 * @return     the channel data, unit: mV
 */
FP32 hal_adc_read(const U8 ch);

/**
 * @brief  get temperature of cpu by internal ADC
 * @return tenperature unit: Celsius degree
 */
FP32 hal_adc_chip_temp(void);

END_DECLS

#endif //~HAL_ADC_H
